<template>
  <view>
    <view class="title">{{ detail.title }}</view>
    <!-- <image :src="detail.imgUrl" mode="aspectFit" style="width: 100%;"></image> -->
    <view class="art" v-html="detail.content"></view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      id: "",
      detail: {},
    };
  },
  onLoad(options) {
    this.id = options.id;
    this.getPlanDetail();
  },
  onReady() {
    // this.getUiStyle();
  },
  methods: {
    getUiStyle() {
      var style = plus.navigator.getUiStyle();
      if ("dark" == style) {
        console.log("当前为暗黑模式");
        uni.setTabBarStyle({
          backgroundColor: "#1B1C1E",
        });
        uni.setNavigationBarColor({
          frontColor: "#ffffff",
          backgroundColor: "#1B1C1E",
          animation: {
            duration: 400,
            timingFunc: "easeIn",
          },
        });
      } else {
        console.log("当前为普通模式");
      }
    },
    getPlanDetail() {
      let self = this;
      uni.showLoading({ title: "加载中", mask: true });
      setTimeout((s) => {
        uni.hideLoading();
      }, 5000);
      this.config
        .get("/communityMessage/getCommunityAnnouncementById", { id: this.id })
        .then((res) => {
          uni.hideLoading();
          if (res.data.code === 200) {
            self.detail = res.data.data;
          } else {
            if (res.data.code == "-201") {
              self.config.handleError(res.data);
            } else {
              uni.showToast({
                title: self.config.handleError(res.data),
                icon: "none",
              });
            }
          }
        });
    },
  },
};
</script>

<style lang="less" scoped>
.title {
  color: #343434;
  font-size: 36upx;
  font-weight: 900;
  text-align: center;
  margin: 30upx 0 60upx;
}
.art {
  padding: 0 30upx;
  line-height: 50upx;
}
</style>
